import 'package:flutter/material.dart';
import 'package:flutter_app/pages/white_board/model/graphics_model.dart';
import 'package:get/get_state_manager/get_state_manager.dart';
export 'package:flutter_app/pages/white_board/gesture_logic.dart';
export 'package:flutter_app/pages/white_board/scale_layer_logic.dart';

class WhiteBoardVM extends GetxController {
  /// 画布当前的缩放比例
  double curCanvasScale = 1.0;

  /// 画布上一次的缩放比例
  double preCanvasScale = 1.0;

  /// 上一次的缩放详情
  ScaleUpdateDetails? lastScaleUpdateDetails;

  /// 最小缩放比例和最大缩放比例
  final double minCanvasScale = 0.1;
  final double maxCanvasScale = 3.0;

  /// 每次缩放的步长
  final double stepScale = 0.1;

  /// 画布当前的偏移量
  Offset curCanvasOffset = Offset.zero;

  /// 上一次的偏移量
  Offset preCanvasOffset = Offset.zero;

  /// 画布的偏移量
  Offset get canvasOffset => curCanvasOffset;

  /// 画布的缩放比例
  double get canvasScale => curCanvasScale;

  List<GraphicsModel> graphicsList = [];

  /// 更新白板
  void updateWhiteBoard(String id) {
    update([id]);
  }
}
